-
-
Notifications
You must be signed in to change notification settings - Fork 159
fix testonly with js_binary so it's not a test
#1486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Conversation
|
Interesting one. Suppose there is no value of tagging a js_binary as testonly. I'm still confused how you get this to fail since neither |
|
Can you show an example that fails without the change? |
|
We have a js_binary target that is not a test itself, but a dependency of a test. The testonly here is a guard against accidental usage outside of a test dag. Presumably you could fix this more properly by having js_test also have a _is_test attr that is set to true. This would allow you to ensure all js_tests have a lcov_merger but allow a js_binary to be used with testonly = True. |
|
Can that be shown with a test that fails without this change though? |
|
@jbedard here is a screenshot from me reproducing the failure with Here is the code |
|
I can confirm also that applying this fix with that code fixes the bug |
|
i believe this is still wrong as _lcov_merger should be present if the coverage is enabled but since we are sharing implementation between js_test and js_binary we need a sentinel attribute for determining where the impl is being invoked so we can still fail if it's js_test. |
|
@thesayyn so are you suggesting that @joeljeske's fix would be preferred?
|
|
Exactly. |
|
@thesayyn Ok I believe I have added the fix as interpreted from @joeljeske's comment. I confirmed with the same test as before that this fix works too |
|
|
|
Looks like this breaks some CI stuff. I'll have to spin up an ubuntu container and debug why |
the current logic is wrong because it tries to test `js_binary` when `testonly` is passed. We actually want the inverse which is we don't want to run js_binary as a test if it is marked as test_only
This addresses the problem in a different way that allows us to not change the existing logic, but instead differentiate one step further with attributes

the current logic is wrong because it tries to test
js_binarywhentestonlyis passed. We actually want the inverse which is we don't want to run js_binary as a test if it is marked as test_only.Bug discovered by myself and @joeljeske
Type of change
For changes visible to end-users
Test plan